#include "stdafx.h"
#include "DailyTaskAwardsCfg.h"
#include "InstanceTouch.h"
DECL_INSTANCE_TOUCH(ETouch_DailyTaskAwards);

struct  DailyTaskAwardsDefReflectionRegister
{
	DailyTaskAwardsDefReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_iTaskType, E_DailyTaskType_NONE).Editor_SetAsEnumation<E_DailyTaskType>();
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_iComplateTimes, 0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_iAwardExp, 0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyTaskAwardsCfg,m_iAwardScrollFragments, 0).Editor_SetAsRaw();
		
		GlobalClassManager::Instance().RegisterClass(DailyTaskAwardsCfg::s_GetReflection(),eDefaultDef_DailyTaskAwards);
		GlobalDefManager::Instance().RegisterDefManger(&DailyTaskAwardsManager::Instance());

	}
}___DailyTaskAwardsDefReflectionRegister;

rewrite  void DailyTaskAwardsCfg::OnArchieveReaded()
{

}

void DailyTaskAwardsManager::OnArchieveReaded()
{
	__DailyTaskAwardsManager::OnArchieveReaded();

	std::vector<const DailyTaskAwardsCfg*> vDailyTaskCfg;
	vDailyTaskCfg.clear();
	Enumerate(vDailyTaskCfg);
	std::vector<const DailyTaskAwardsCfg*>::iterator it = vDailyTaskCfg.begin();
	for ( ; it != vDailyTaskCfg.end(); it++) {
		m_DailyTaskCfg[(*it)->m_iTaskType] = *it;
	}
}

const DailyTaskAwardsCfg* DailyTaskAwardsManager::GetDailyTaskCfg(E_DailyTaskType eType)
{
	DAILYTASKCFG_MAP::iterator it = m_DailyTaskCfg.find(eType);
	if ( it == m_DailyTaskCfg.end()) {
		return NULL;
	}
	return it->second;
}